package com.cxyzy.basic_libs

import android.app.Activity
import android.content.Context
import android.view.ViewGroup
import android.widget.TextView


/**
 * 添加TextView
 */
fun Activity.显示文本(text: String, parentView: ViewGroup? = null) =
    addView(getTextView(text, this), parentView ?: getContentView(this))

fun Activity.showText(text: String, parentView: ViewGroup? = null) =
    addView(getTextView(text, this), parentView ?: getContentView(this))

private fun getTextView(text: String, context: Context): TextView {
    val view = TextView(context)
    view.text = text
    return view
}


